﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FreeDAM.Domain.Abstract;

namespace FreeDAM.Domain.Concrete
{
    public class EfDatabaseFactory : Disposable, IDatabaseFactory
    {
        private EfDbContext DbContext;

        public EfDbContext Get()
        {
            return DbContext ?? (DbContext = new EfDbContext());
        }

        protected override void DisposeCore()
        {
            if (DbContext != null)
            {
                DbContext.Dispose();
            }
        }
    }
}
